﻿@using Apps.Web.Core;
@using Apps.Web;
@using Apps.Common;
@using Apps.Models.Sys;
@using Apps.Locale;
@using Apps.Web.Core;
@using Apps.Web;
@using Apps.Common;
@using Apps.Models.Sys;
@using Apps.Locale;
@using Wantn.FIS.Enum
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Index_Layout.cshtml";
    List<permModel> perm = null;
    //化产数据查询
}
<script src="@Url.Content("~/Scripts/easyui/datagrid-export.js")" type="text/javascript"></script>
<div id="uploadExcel" class="easyui-window" data-options="modal:true,closed:true,minimizable:false,shadow:false">
    <form name="form1" method="post" id="form1">
        <table>
            <tr>
                <th style="padding:20px; "> Excel：</th>
                <td style="padding:20px; ">
                    <input name="ExcelPath" type="text" maxlength="255" id="txtExcelPath" readonly="readonly" style="width:200px" class="txtInput normal left">
                    <a href="javascript:$('#FileUpload').trigger('click').void(0);" class="files">@Resource.Browse</a>
                    <input class="displaynone" type="file" id="FileUpload" name="FileUpload" onchange="Upload('ExcelFile', 'txtExcelPath', 'FileUpload'); ">
                    <span class="uploading">@Resource.Uploading</span>
                </td>
            </tr>
        </table>
        <div class="endbtndiv">
            <a id="btnSave" href="javascript:ImportData()" class="easyui-linkbutton btns">直接保存</a>
            <a id="btnReturn" href="javascript:$('#uploadExcel').window('close')" class="easyui-linkbutton btnc">@Resource.Cancel</a>
        </div>
    </form>
</div>
<div class="mvctool">
    <input id="txtStartDate" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd', maxDate: '#F{$dp.$D(\'txtEndDate\')}' })" class="condition-date" type="text" placeholder="化验日期起" />
    <input id="txtEndDate" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd', minDate: '#F{$dp.$D(\'txtStartDate\')}' })" class="condition-date" type="text" placeholder="化验日期止" />
    <select id="formState" name="formState" style="width:130px" autocomplete="off">
        <option value="">审核状态</option>
        <option value="未审核">未审核</option>
        <option value="审核通过">审核通过</option>
        <option value="审核未通过">审核未通过</option>
    </select>
    @Html.ToolButton("btnQuery", "fa fa-search", Resource.Query, ref perm, "Query", true)
    @Html.ToolButton("btnExprot", "fa fa-download", Resource.Export, ref perm, "Export", true)
</div>
<table id="List"></table>
@Html.Partial("~/Views/Shared/_Partial_AutoGrid.cshtml")
<div id="modalwindow" class="easyui-window" style="width:800px; height:400px;" data-options="modal:true,closed:true,minimizable:false,shadow:false"></div>
<script type="text/javascript">
  $(function () {
     $('#List').datagrid({
         url: '@Url.Action("GetList")',
         width: SetGridWidthSub(10),
         methord: 'post',
         height: SetGridHeightSub(45),
         fitColumns: true,
         //sortName: 'ADDTIME',
         //sortOrder: 'desc',
         //idField: 'ID',
         pageSize: 15,
         pageList: [15, 20, 30, 40, 50],
         pagination: false,
         striped: false, //奇偶行是否区分
         singleSelect: true,//单选模式
         selectOnCheck: false,
         checkOnSelect: false,
         //checkbox: true,
         //rownumbers: true,//行号
         onLoadSuccess: function (data) {
             $("#List").datagrid("clearSelections"); //全部不选中
             $("#List").datagrid("clearChecked"); //全部不选中
             $("#List").datagrid("unselectAll"); //全部不选中
         },
         columns: [[
             /*{ field: 'ID', title: '编号', width: '120px' },*/
             { field: 'PROJECTID', title: '', width: '100px' },
             { field: 'DATA1', title: '', width: 150, sortable: true },
             { field: 'DATA2', title: '', width: 150 },
             { field: 'DATA3', title: '', width: 150 },
             { field: 'DATA4', title: '', width: 150 },
             { field: 'DATA5', title: '', width: 150 },
             { field: 'DATA6', title: '', width: 150 },
             { field: 'DATA8', title: '', width: 150 },
             { field: 'DATA9', title: '', width: 150 },
             { field: 'DATA10', title: '', width: 150 },
             { field: 'DATA11', title: '', width: 150 },
             { field: 'DATA12', title: '', width: 150 },
             { field: 'DATA13', title: '', width: 150 },
             { field: 'DATA14', title: '', width: 150 },
             { field: 'DATA15', title: '', width: 150 },
             { field: 'DATA16', title: '', width: 150 },
             { field: 'DATA17', title: '', width: 150 },
             { field: 'DATA18', title: '', width: 150 },
             { field: 'DATA19', title: '', width: 150 },
             { field: 'DATA20', title: '', width: 150 },
             { field: 'DATA21', title: '', width: 150 },
             { field: 'DATA22', title: '', width: 150 },
             { field: 'DATA23', title: '', width: 150 },
             { field: 'DATA24', title: '', width: 150 },
             { field: 'DATA25', title: '', width: 150 },
             { field: 'DATA26', title: '', width: 150 },
             { field: 'DATA27', title: '', width: 150 },
             { field: 'DATA28', title: '', width: 150 },
             { field: 'DATA29', title: '', width: 150 },
             { field: 'DATA30', title: '', width: 150 },
             //{ field: 'CRI', title: 'CRI%', width: 80 },
             //{ field: 'CSR', title: 'CSR%', width: 80 },
             //{ field: 'TEST_TIME', title: '化验时间', width: 140 },
             //{ field: 'TEST_USER', title: '化验员', width: 80 },
             //{ field: 'REMARK', title: '备注', width: 80 },
         ]], onClickRow: function (index, row) {
         },
         rowStyler: function (index, row) {
             if (row.ID =="表头") {
                 return 'background-color:#f2f2f2;color:#000;font-weight:bold;';
             }
         }
     });
 });

    //ifram 返回
    function frameReturnByClose() {
        $("#modalwindow").window('close');
    }
    function frameReturnByReload(flag) {
        if (flag)
            $("#List").datagrid('load');
        else
            $("#List").datagrid('reload');

        $("#List").datagrid("clearSelections"); //全部不选中
        $("#List").datagrid("clearChecked"); //全部不选中
        $("#List").datagrid("unselectAll"); //全部不选中
    }
    function frameReturnByMes(mes) {
        $.messageBox5s(Lang.Tip, mes);
    }
    $(function () {
        $("#btnQuery").click(function () {
            let startdate = $("#txtStartDate").val();
            let enddate = $("#txtEndDate").val();
            if (startdate == '' || startdate == undefined) {
                $.messageBox5s(Lang.Tip, '请选择开始时间');
                return;
            }
            if (enddate == '' || enddate == undefined) {
                $.messageBox5s(Lang.Tip, '请选择结束时间');
                return;
            }

            $("#List").datagrid("load", {
                isExamine: $("#formState").val(),
                startdate: $("#txtStartDate").val(),
                enddate: $("#txtEndDate").val(),
            });
        });
       
        $("#btnExprot").click(function () {
            $('#List').datagrid('toExcel', '化产数据导出.xls');	// export to excel
         });
    });
</script>

